package com.oak.consumer;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * com.oak.consumer -> ConsumerController
 *
 * @Author: guoxy
 * @Description:
 * @Date: 2022/5/15
 */
@RestController
public class ConsumerController {

    private static RestTemplate restTemplate = new RestTemplate();

    private static final String SERVER_URL = "http://consul-provide-server";

    /**
     * 调用服务
     *
     * @return
     */
    @GetMapping("/getOrder")
    private String getOrder() {
        return restTemplate.getForObject(SERVER_URL + "/order", String.class);
    }

}